package Top_Interview_Questions_Review._009Linked_List;


import Top_Interview_Questions_Review.ListNode;

/**
 * @Author: 吕庆龙
 * @Date: 2020/3/10 19:40
 * <p>
 * 功能描述:
 */
public class _0328 {

    public ListNode oddEvenList(ListNode head) {
        //head和odd保存奇节点,even和evenhead保存偶节点
        if (head == null) return null;
        ListNode odd = head, even = head.next, evenHead = even;
        while (even != null && even.next != null) {
            odd.next = even.next;
            odd = odd.next;
            even.next = odd.next;
            even = even.next;
        }
        odd.next = evenHead;
        return head;
    }


}
